#define MAXBUTTONS 10;
enum buttontype{PLAY, QUIT, ABOUT, EMPTY, HOWTO, HIGHSCORES};
struct Button
{
        int x;
        int y;
        int length;
        int height;
        bool hovered;
        bool live;
        char name[10];
        int type;
};
void initbuttons(Button buttonname[])
{
        for(int i = 0; i < 10; i++)
        {
                buttonname[i].height = 0;
                buttonname[i].hovered = false;
                buttonname[i].live = false;
        }
}
void createbuttons(Button buttonname[], int x, int y, int length, int height, char name[30], int Buttontype)
{
        for(int i = 0; i < 10; i++)
        {
                if(buttonname[i].live == false)
                {
                        buttonname[i].x = x;
                        buttonname[i].y = y;
                        buttonname[i].height = height;
                        buttonname[i].length = length;
                        for(int c = 0; c <= 30;c++)
                        {
                                buttonname[i].name[c] = name[c];
                        }
                        buttonname[i].type = Buttontype;
                        buttonname[i].live = true;
                        return;
                }
        }
}
void drawbuttons(Button buttonname[], ALLEGRO_FONT *font)
{
        for(int i = 0; i < 10; i++)
        {
                if(buttonname[i].live)
                {
                        al_draw_filled_rectangle(buttonname[i].x,buttonname[i].y,buttonname[i].x+buttonname[i].length,buttonname[i].y+buttonname[i].height,al_map_rgb(200,200,200));
                        al_draw_text(font,al_map_rgb(200,0,0),buttonname[i].x,buttonname[i].y,NULL,buttonname[i].name);
                        if(buttonname[i].hovered)
                                al_draw_filled_circle(buttonname[i].x+buttonname[i].length,buttonname[i].y+buttonname[i].height,20,al_map_rgb(200,200,200));
                }
        }
}
int checkforbuttonpress(Button buttonname[], Mouse mouse)
{
        for(int i = 0; i < 10; i++)
        {
                if(buttonname[i].live)
                {
                        if((mouse.x > buttonname[i].x + buttonname[i].length - 1) || 
                                (mouse.y > buttonname[i].y + buttonname[i].height - 1) || 
                                (buttonname[i].x > mouse.x + 1 - 1) || 
                                (buttonname[i].y > mouse.y + 1 - 1))
                        {
                                buttonname[i].hovered = false;
                        }
                        else
                        {
                                buttonname[i].hovered = true;
                                return buttonname[i].type;
                        }
                }
        }
}